package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

@Setter
@Getter
public class Attendance extends BaseDomain{
    //用户id
    private User user;
    //最后签到时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date signTime;
    //签到次数
    private Integer signNum=0;
    //已获得的积分
    private Integer integral=0;
    //当月签到的日期
    private String  signTimes;
    //获取上月的签到信息
    private String prevMouthTimes;

    public int[] getSignTimess(){
        String[] arr = signTimes.split(";");
        int[] arry=new int[arr.length];
        for (int i=0;i<arr.length;i++){
            arry[i]=Integer.valueOf(arr[i]);
        }
        System.out.println(Arrays.toString(arry));
        return  arry;
    }
    public int[] getPrevMouthTimess(){
        String[] arr = prevMouthTimes.split(";");
        int[] arry=new int[arr.length];
        for (int i=0;i<arr.length;i++){
            arry[i]=Integer.valueOf(arr[i]);
        }
        System.out.println(Arrays.toString(arry));
        return  arry;
    }

    public Date getLastSignTime(){

        return signTime;
    }

}